package edu.nctu.csie.jichang.dp.structural;

public class Bridge {
	public static void main(String[] args) {
		Storage tFlashUsb = new Usb(new Flash("chip 0x01"));
		Storage tDRamUsb  = new Usb(new DRam("chip 0x03"));
		Storage tFlashDisk = new Disk(new Flash("chip 0x01"));
		Storage tDRamDisk  = new Disk(new DRam("chip 0x02"));
		System.out.println(tFlashUsb.ram.type);
		System.out.println(tDRamUsb.ram.type);
		System.out.println(tFlashDisk.ram.type);
		System.out.println(tDRamDisk.ram.type);
	}
}
abstract class Storage{
	Ram ram;
	Storage(Ram ram){this.ram=ram;}
}
class Usb extends Storage{Usb(Ram ram) {super(ram);}}
class Disk extends Storage{Disk(Ram ram) {super(ram);}}
abstract class Ram{
	String type;
	Ram(String type){this.type=type;}
}
class DRam extends Ram{ DRam(String type) {super(type);}}
class Flash extends Ram{ Flash(String type) {super(type);}}
